'use strict';
module.exports = app => {
  const { BOOLEAN, INTEGER, STRING } = app.Sequelize;
  // 余额变动记录
  const BalanceRecord = app.model.define('balanceRecord', {
    balance: { type: INTEGER, allowNull: false }, // 余额
    price: { type: INTEGER, allowNull: false }, // 金额
    add: { type: BOOLEAN, allowNull: false }, // 增减与否
    remark: { type: STRING, allowNull: false }, // 备注
  });

  BalanceRecord.associate = function() {
    // 用户
    BalanceRecord.belongsTo(app.model.User);
  };

  return BalanceRecord;
};
